import type { IQuery, IResponse, TableResponse } from '@/api/config/types';
import axios from 'axios'; // 确保你导入了正确的 axios 实例或配置

const prefix = '/app/carousel';
export interface AppCarousel {
  id: string;
  picture: string;
  link: string;
  linkTarget: string;
  beginTime: string;
  endTime: null;
  enable: '0' | '1';
  sort: number;
}
export const listCarousel = (query: IQuery) => {
  return axios.get<TableResponse<AppCarousel>>(`${prefix}/list`, { params: query });
};

export const addCarousel = (data: AppCarousel) => {
  return axios.post<IResponse>(`${prefix}`, data);
};

export const updateCarousel = (data: AppCarousel) => {
  return axios.put<IResponse>(`${prefix}`, data);
};

export const getCarousel = (id: string) => {
  return axios.get<IResponse<AppCarousel>>(`${prefix}/${id}`);
};

export const deleteCarousel = (id: string) => {
  return axios.delete<IResponse>(`${prefix}/${id}`);
};
